/** 事件管理
 * 1. 关机/锁屏事件
 * 2. 活动窗口事件
 * */
const app = {
  state (){
    return {
      // 系统应用
      appList: [ // 系统中的应用
        {icon: '/static/image/system/icon/icon-demo.png', title: 'sfassfasffsfasff', type: 'drawbox', noRepeatOpen: false},
        {icon: '/static/image/system/icon/icon-demo.png', title: 'asdsdfasfasffsasfasfsafasfasffsfasff', type: ''},
        {icon: '/static/image/system/icon/icon-demo.png', title: 'asdsdfasfasfsafafsafasfasffsfasff', type: ''},
        {icon: '/static/image/system/icon/icon-demo.png', title: 'asdsdfasfasfsasdfasfasfsafasfasffsfasff', type: ''},
        {icon: '/static/image/system/icon/icon-demo.png', title: 'asdsdfasfasfsafaasfasafasfasffsfasff', type: ''},
        {icon: '/static/image/system/icon/icon-demo.png', title: 'asdsdfsffasdsdfasfasfsafasfasffsfasff', type: ''},
      ],
      // 资源管理器
      resourceTree: [
        {appIndex: 0, title: '快捷方式1', appType: ''},
        {appIndex: 1, title: '快捷方式2', appType: ''},
        {appIndex: 2, title: '快捷方式3', appType: ''},
        {appIndex: 3, title: '快捷方式4', appType: ''},
      ],
      // 已打开应用列表
      openAppList: [],
    }
  },
  mutations: {
    openApp: (state, option) => { // 打开应用
      state.openAppList.push(option);
    },
    closeApp: (state, index) => { // 关闭应用
      state.openAppList.splice(index, 1);
    },
    openAppList: (state, data) => { // 全部覆盖
      state.openAppList = data;
    },
  },
  getters: {
    openAppList: (state) => {
      return state.openAppList;
    },
  }
};
export default app;